﻿using UnityEngine;
using System.Collections;

public class testcristal : MonoBehaviour {

	public GameObject nextCristal;

	IEnumerator Wait() {
		Debug.Log("Before Waiting 2 seconds");
		yield return new WaitForSeconds(2);
		Debug.Log("After Waiting 2 Seconds");
	}

	void cristal(){
				nextCristal.SetActive (true);
		}

	void Awake () {
		this.gameObject.SetActive (false);
	}

	void OnTriggerEnter2D(Collider2D coll){

				if (coll.gameObject.tag != "player") {
		
						if ((gameObject.tag == "ObjetFeu" && coll.gameObject.tag == "Fire_Bolt")
								|| (gameObject.tag == "ObjetEau" && coll.gameObject.tag == "Water_Bolt")
								|| (gameObject.tag == "ObjetAir" && coll.gameObject.tag == "Air_Bolt")) {
								PontController.moving = true;
								Destroy (coll.gameObject);
								this.gameObject.SetActive(false);
								
								Invoke ("cristal",2.4f); 
				
								}

				}
		}
}
